<!DOCTYPE html>
<html lang="zxx">

<head>
    <meta charset="utf-8" />
    <meta http-equiv="x-ua-compatible" content="ie=edge" />
    <meta name="description" content="" />
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
    <title>NY·房屋租赁社区-房源列表</title>
    <link rel="shortcut icon" href="assets/img/favicon.png" type="img/png" />
    <link rel="stylesheet" href="assets/css/animate.min.css">
    <link rel="stylesheet" href="assets/css/bootstrap.min.css" />
    <link rel="stylesheet" href="assets/css/font-awesome.min.css" />
    <link rel="stylesheet" href="assets/css/flaticon.css" />
    <link rel="stylesheet" href="assets/css/magnific-popup.css" />
    <link rel="stylesheet" href="assets/css/slick.css" />
    <link rel="stylesheet" href="assets/css/nice-select.css" />
    <link rel="stylesheet" href="assets/css/leaflet.css" />
    <link rel="stylesheet" href="assets/css/mapbox-gl.min.css" />
    <link rel="stylesheet" href="assets/css/bootstrap-datepicker.css" />
    <link rel="stylesheet" href="assets/css/default.css" />
    <link rel="stylesheet" href="assets/css/style.css" />
    <link rel="stylesheet" href="assets/css/alert.css">
</head>

<body>

<!-- 头部开始 -->
<div class="preloader d-flex align-items-center justify-content-center">
    <div class="cssload-container">
        <div class="cssload-loading"><i></i><i></i><i></i><i></i></div>
    </div>
</div>

<header class="header-absolute sticky-header">
    <div class="container container-custom-one">
        <div class="nav-container d-flex align-items-center justify-content-between">

            <div class="nav-menu d-lg-flex align-items-center">


                <div class="navbar-close">
                    <div class="cross-wrap"><span class="top"></span><span class="bottom"></span></div>
                </div>


                <div class="toggle">
                    <a href="#" id="offCanvasBtn"><i class="fal fa-bars"></i></a>
                </div>

                <div class="menu-items">
                    <ul>
                        <li>
                            <a href="index.html">主页</a>
                        </li>
                        <li>
                            <a href="apartment-grid.html">我要找房</a>
                        </li>
                        <li>
                            <a href="classification.html">房源类型</a>
                        </li>
                        <li>
                            <a href="places.html">地图找房</a>
                        </li>
                        <li><a href="news.html">社区文化</a>

                        </li>
                    </ul>
                </div>


                <div class="nav-pushed-item"></div>
            </div>


            <div class="site-logo">
                <a href="index.html"><img src="assets/img/logo.png" alt="Logo"></a>
            </div>


            <div class="nav-push-item">

                <div class="header-info d-lg-flex align-items-center">
                    <div class="item">
                        <i class="fal fa-phone"></i>
                        <span>联系我们</span>
                        <a href="tel:+90898787709">
                            <h5 class="title">+1565 5757 567</h5>
                        </a>
                    </div>
                    <div class="item">
                        <i class="fal fa-envelope"></i>
                        <span>客服邮箱</span>
                        <a href="mailto:info@webmail.com">
                            <h5 class="title">jiajia@webmail.com</h5>
                        </a>
                    </div>
                </div>
            </div>

            <div class="navbar-toggler">
                <span></span><span></span><span></span>
            </div>
        </div>
    </div>
</header>

<div class="offcanvas-wrapper">
    <div class="offcanvas-overly"></div>
    <div class="offcanvas-widget">
        <a href="#" class="offcanvas-close"><i class="fal fa-times"></i></a>
        <div class="widget search-widget">
            <h5 class="widget-title">搜 房</h5>
            <form>
                <input type="text" id="content1" placeholder="请输入关键词">
                <button type="button" id="search1"><i class="far fa-search"></i></button>
            </form>
        </div>

        <div class="widget about-widget">
            <h5 class="widget-title">关于我们</h5>
            <p>
                NYCONDOS APARTMENTS·房屋租赁社区简称NY·房屋租赁社区，隶属于河南省郑州市-郑州航空工业管理学院-佳佳有限公司。2021年成立于河南郑州，
                是由郑州航院佳佳有限公司与江苏南京欣媚投资管理有限公司联合成立的郑州住房租赁行业第一家合资企业，是专注于为追求
                丰富生活体验的城市精英租房群体服务的集中式长租公寓连锁运营商。NY·房屋租赁社区致力于为租房人群提供完备的公寓产品，
                打造温馨的文化社区，以多样化的社群场景，为有态度的租房一族带来花样生活。
            </p>
        </div>

        <div class="widget nav-widget">
            <h5 class="widget-title">浏览导航</h5>
            <ul>
                <li><a href="index.html">主页</a></li>
                <li>
                    <a href="trending.html">我要找房</a>
                </li>
                <li>
                    <a href="classification.html">房源类型</a>
                </li>
                <li>
                    <a href="places.html">地图找房</a>
                </li>
                <li><a href="news.html">社区文化</a>

                </li>
            </ul>
        </div>

        <div class="widget social-link">
            <h5 class="widget-title">联系我们</h5>
            <ul>
                <li><a href="#"><i class="fab fa-facebook-f"></i></a></li>
                <li><a href="#"><i class="fab fa-twitter"></i></a></li>
                <li><a href="#"><i class="fab fa-behance"></i></a></li>
                <li><a href="#"><i class="fab fa-linkedin"></i></a></li>
                <li><a href="#"><i class="fab fa-google"></i></a></li>
            </ul>
        </div>
    </div>
</div>
<!-- 头部结束 -->



    <section class="breadcrumb-area" style="background-image: url(assets/img/bg/04.jpg);">
        <div class="container">
            <div class="breadcrumb-text">
                <span>NYCONDOS APARTMENTS</span>
                <h2 class="page-title">NY·房屋租赁社区</h2>

                <ul class="breadcrumb-nav">
                    <li><a href="index.html">主页</a></li>
                    <li onclick="location.href='apartment-list.html'"><a href="javascript:void(0);">竖铺展示</a></li>
                </ul>
            </div>
        </div>
    </section>


    <section class="room-section room-grid-style pt-120 pb-120">
        <div class="container">
            <div class="row justify-content-center room-gird-loop" id="room">

                <!--<div class="col-lg-4 col-md-6 col-sm-6">-->
                    <!--<div class="room-box mb-30">-->
                        <!--<div class="room-img-wrap">-->
                            <!--<div class="room-img" style="background-image: url(assets/img/room/01.jpg);"></div>-->
                        <!--</div>-->
                        <!--<div class="room-desc">-->
                            <!--<ul class="icons">-->
                                <!--<li><i class="fal fa-bed"></i></li>-->
                                <!--<li><i class="fal fa-wifi"></i></li>-->
                                <!--<li><i class="fal fa-car"></i></li>-->
                                <!--<li><i class="fal fa-coffee"></i></li>-->
                                <!--<li><i class="fal fa-concierge-bell"></i></li>-->
                                <!--<li><i class="fal fa-compress-arrows-alt"></i></li>-->
                                <!--<li><i class="fal fa-swimmer"></i></li>-->
                            <!--</ul>-->
                            <!--<h4 class="title"><a href="#">Minimal Duplex Apartment</a></h4>-->
                            <!--<p>Lorem ipsum dolor sit amet, consectetur adipi sicing elit, sed do eiusmod tempor.</p>-->
                            <!--<span class="price">$345/Month</span>-->
                            <!--<a href="#" class="book-btn">Booking Now</a>-->
                        <!--</div>-->
                    <!--</div>-->
                <!--</div>-->


            </div>
            <div class="pagination-wrap">
                <ul id="pageNumber">
                    <!--<li><a href="#"><i class="far fa-angle-double-left"></i></a></li>-->
                    <!--<li class="active"><a href="#">1</a></li>-->
                    <!--<li><a href="#">2</a></li>-->
                    <!--<li><a href="#">3</a></li>-->
                    <!--<li><a href="#">...</a></li>-->
                    <!--<li><a href="#">10</a></li>-->
                    <!--<li><a href="#"><i class="far fa-angle-double-right"></i></a></li>-->
                </ul>
            </div>
        </div>
    </section>

    <a href="#" class="back-to-top" id="backToTop">
        <i class="fal fa-angle-double-up"></i>
    </a>

    <footer>
        <div class="footer-subscibe-area pt-120 pb-120">
            <div class="container">
                <div class="row justify-content-center">
                    <div class="col-lg-8">
                        <div class="subscribe-text text-center">
                            <div class="footer-logo mb-45">
                                <img src="assets/img/logo-2.png" alt="images">
                            </div>
                            <p>
                                NY·房屋租赁社区致力于为租房人群提供完备的公寓产品，
                                打造温馨的文化社区，以多样化的社群场景，为有态度的租房一族带来花样生活。
                            </p>
                            <form onclick="" class="subscribe-form mt-50">
                                <input type="text" id="content2" placeholder="请输入房源关键词">
                                <button type="button" id="search2">搜 索</button>
                            </form>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="copyright-area pt-20 pb-20">
            <div class="container">
                <div class="row align-items-center">
                    <div class="col-md-5 order-2 order-md-1">
                        <p class="copyright-text">Copyright 安思佳©版权所有 2017-2021</p>
                    </div>
                    <div class="col-md-7 order-1 order-md-2">
                        <div class="social-links">
                            <a href="#"><i class="fab fa-facebook-f"></i></a>
                            <a href="#"><i class="fab fa-twitter"></i></a>
                            <a href="#"><i class="fab fa-behance"></i></a>
                            <a href="#"><i class="fab fa-linkedin"></i></a>
                            <a href="#"><i class="fab fa-youtube"></i></a>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </footer>

    <script src="assets/js/vendor/modernizr-3.6.0.min.js"></script>
    <script src="assets/js/vendor/jquery-1.12.4.min.js"></script>
    <script src="assets/js/bootstrap.min.js"></script>
    <script src="assets/js/popper.min.js"></script>
    <script src="assets/js/slick.min.js"></script>
    <script src="assets/js/isotope.pkgd.min.js"></script>
    <script src="assets/js/jquery.magnific-popup.min.js"></script>
    <script src="assets/js/jquery.inview.min.js"></script>
    <script src="assets/js/jquery.countTo.js"></script>
    <script src="assets/js/jquery.nice-select.min.js"></script>
    <script src="assets/js/bootstrap-datepicker.js"></script>
    <script src="assets/js/wow.min.js"></script>
  	<script src="assets/js/leaflet.js"></script>
  	<script src="assets/js/mapbox-gl.min.js"></script>
  	<script src="assets/js/map.js"></script>
    <script src="assets/js/main.js"></script>
    <script src="assets/js/alert.js"></script>
    <script type="text/javascript">

        var search3 = getUrlParam("search");

        if (search3 == 'true') {
            var content3 = decodeURI(getUrlParam("content"));
            if (content3 != null && content3 != ' ') {
                page(1, content3);
            }else {
                page(1, null);
            }
        } else {
            page(1, null);
        }

        function page(pageNum, content) {
            $.ajax({
                url: 'house-room/list',
                data: {
                    pageNum : pageNum,
                    pageSize : 6,
                    content: content
                },
                type: 'get',
                dataType: 'json',
                success: function (result) {
                    if (result.code == 200) {
                        $("#room").html("");
                        $("#pageNumber").html("");

                        var houseRoomList = result.data.houseRoomList;
                        for (var i = 0; i < houseRoomList.length; i++) {
                            append(houseRoomList[i]);
                        }

                        pageNumber(result.data);

                    }
                }
            });
        };
        
        function pageNumber(data) {
            var pageCount = data.pageCount;
            var pageNum = data.pageNum;
            var number = 1;
            if (pageNum <= 1) {
                $("#pageNumber").append("<li><a><i class=\"far fa-angle-double-left\"></i></a></li>");
            }else {
                $("#pageNumber").append("<li><a href='javascript:void(0);' onclick='page("+ (pageNum - number) +", getSearchContent())'><i class=\"far fa-angle-double-left\"></i></a></li>");
            }

            for (var i = 1; i <= pageCount; i++) {
                if (i == pageNum) {
                    $("#pageNumber").append("<li class=\"active\"><a>"+ i +"</a></li>");
                }else {
                    $("#pageNumber").append("<li><a href='javascript:void(0);' onclick='page("+ i +", getSearchContent())'>"+ i +"</a></li>");
                }
            }

            if (pageNum >= pageCount) {
                $("#pageNumber").append("<li><a><i class=\"far fa-angle-double-right\"></i></a></li>");
            }else {
                $("#pageNumber").append("<li><a href='javascript:void(0);' onclick='page("+ (pageNum + number) +", getSearchContent())'><i class=\"far fa-angle-double-right\"></i></a></li>");
            }


        }

        function append(item) {
            $("#room").append("<div class=\"col-lg-4 col-md-6 col-sm-6\">\n" +
                "                    <div class=\"room-box mb-30\">\n" +
                "                        <div class=\"room-img-wrap\">\n" +
                "                            <div class=\"room-img\" style=\"background-image: url("+ item.url +");\"></div>\n" +
                "                        </div>\n" +
                "                        <div class=\"room-desc\">\n" +
                "                            <ul class=\"icons\">\n" +
                "                                <li><i class=\"fal fa-bed\"></i></li>\n" +
                "                                <li><i class=\"fal fa-wifi\"></i></li>\n" +
                "                                <li><i class=\"fal fa-car\"></i></li>\n" +
                "                                <li><i class=\"fal fa-coffee\"></i></li>\n" +
                "                                <li><i class=\"fal fa-concierge-bell\"></i></li>\n" +
                "                                <li><i class=\"fal fa-compress-arrows-alt\"></i></li>\n" +
                "                                <li><i class=\"fal fa-swimmer\"></i></li>\n" +
                "                            </ul>\n" +
                "                            <h4 class=\"title\"><a href='javascript:void(0);' onclick='getDetail("+ item.id +")'>"+ item.name +"</a></h4>\n" +
                "                            <p>"+ item.introduce +"</p>\n" +
                "                            <span class=\"price\">￥"+ item.price +"/月</span>\n" +
                "                            <a href='javascript:void(0);' onclick='getDetail("+ item.id +")' class=\"book-btn\">详 情</a>\n" +
                "                        </div>\n" +
                "                    </div>\n" +
                "                </div>");
        };


        $("#search1").click(function () {
            search($("#content1").val());
        });

        $("#search2").click(function () {
            search($("#content2").val());
        });

        function search(content) {
            if (content == null || content == ' ') {
                page(1, null);
            }else {
                $.ajax({
                    url: 'house-room/list',
                    data: {
                        pageNum : 1,
                        pageSize : 1,
                        content: content
                    },
                    type: 'get',
                    dataType: 'json',
                    success: function (result) {
                        if (result.code == 200) {
                            var houseRoomList = result.data.houseRoomList;
                            if (houseRoomList.length == 0) {
                                alert("抱歉！未搜索到合适房源，请重新搜索！");
                            }else {
                                page(1, content);
                            }
                        }
                    }
                });

            }
        }

        function getSearchContent() {
            if (search3 == 'true') {
                var content3 = getUrlParam("content");
                if (content3 != null && content3 != ' ') {
                    return content3;
                }
            }
            if ($("#content2").val() != null && $("#content2").val() != ' ') {
                return $("#content2").val();
            }
            if ($("#content1").val() != null && $("#content1").val() != ' ') {
                return $("#content1").val();
            }
            return null;
        };

        function getDetail(roomId) {
            location.href='apartment-details.html?roomId=' + roomId;
        }

        //获取url中的参数
        function getUrlParam(name) {
            var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); //构造一个含有目标参数的正则表达式对象
            var r = window.location.search.substr(1).match(reg);  //匹配目标参数
            if (r != null) return unescape(r[2]); return null; //返回参数值
        }

    </script>
</body>

</html>
